﻿using System;
using System.Windows;
using System.Windows.Controls;
using DevExpress.Xpf.Core;
using QuanLyKho.Report;
using DevExpress.Xpf.Printing;
using DevExpress.Xpf.Docking;
using QuanLyKho.Server.BLL;
using QuanLyKho.Server;
using DevExpress.XtraRichEdit.API.Word;
using QuanLyKho.Server.Dto;
using System.Collections.Generic;
using System.Linq;


namespace QuanLyKho
{
    /// <summary>
    /// Interaction logic for frmThongKeTongBNChayThan.xaml
    /// </summary>
    public partial class ucThongKeTienNo : UserControl
    {
        #region Fields

        TienNoBLL tienNoBLL;

        #endregion

        public ucThongKeTienNo()
        {
            InitializeComponent();
            tienNoBLL = new TienNoBLL();
        }

        private void btnDong_Click(object sender, RoutedEventArgs e)
        {
            DockLayoutManager dockLayoutManager = this.Parent as DockLayoutManager;
            BaseLayoutItem bli = dockLayoutManager.ActiveMDIItem;
            if (bli != null)
            {
                dockLayoutManager.DockController.Close(bli);
            }
        }

        private void btnThongKe_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                gridThongKe.ItemsSource = tienNoBLL.ThongKeTienNo(calendar.StartDate, calendar.EndDate,cboTienNo.SelectedIndex);
                gridThongKe.RefreshData();
            }
            catch (Exception)
            {
                DXMessageBox.Show("Thống kê không thành công", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
    }
}
